# -*- coding: utf-8 -*-
"""
@Time ： 2023/10/17 20:27
@Auth ： y.h
@File ：many_col_iter_calculation_properties.py
@IDE ：PyCharm
@Motto：The sooner you start to code, the longer the program will take. —— Roy Carlson
"""
import pandas

from pythonProjectTemplate.Entity.Enum.calculating_type_enum import 运算符


class 多列多行迭代运算配置文件:
    __df_1 = None
    __col_list_1 = []
    __row_list_1 = []
    __col_begin_1 = 0
    __col_end_1 = 0
    __row_begin_1 = 0
    __row_end_1 = 0

    __df_2 = None
    __col_list_2 = []
    __row_list_2 = []
    __col_begin_2 = 0
    __col_end_2 = 0
    __row_begin_2 = 0
    __row_end_2 = 0

    __return_table_style = False
    __operator = None

    # 表1配置 -------------->>>>>>>>>>>>  开始
    def get_df_1(self):
        return self.__df_1

    def 配置数据集1(self, df):
        if type(df) != type(pandas.DataFrame()):
            print(f"多列多行迭代运算配置文件错误,需要一个{type(pandas.DataFrame())},参数为{type(df)}")
            exit(True)
        else:
            self.__df_1 = df
        return self

    def get_col_list_1(self):
        return self.__col_list_1

    def 配置表1列索引(self, col_list):
        self.__col_list_1 = []
        if type(col_list) != type(list()):
            self.__col_list_1.append(col_list)
        else:
            self.__col_list_1.extend(col_list)
        return self

    def get_row_list_1(self):
        return self.__row_list_1

    def 配置表1行索引(self, row_list):
        self.__row_list_1 = []
        if type(row_list) != type(list()):
            self.__row_list_1.append(row_list)
        else:
            self.__row_list_1.extend(row_list)
        return self

    def get_col_begin_1(self):
        return self.__col_begin_1

    def 配置表1运算起始列(self, begin_index):
        if type(begin_index) != type(int()):
            print(f"多列多行迭代运算配置文件->配置表1运算起始列错误!,需要一个{type(int())},参数为{type(begin_index)}")
            exit(True)
        else:
            self.__col_begin_1 = begin_index
        return self

    def get_col_end_1(self):
        return self.__col_end_1

    def 配置表1运算截止列(self, end_index):
        if type(end_index) != type(int()):
            print(f"多列多行迭代运算配置文件->配置表1运算截止列错误!,需要一个{type(int())},参数为{type(end_index)}")
            exit(True)
        else:
            self.__col_end_1 = end_index
        return self

    def get_row_begin_1(self):
        return self.__row_begin_1

    def 配置表1运算起始行(self, begin_index):
        if type(begin_index) != type(int()):
            print(f"多列多行迭代运算配置文件->配置表1运算起始行错误!,需要一个{type(int())},参数为{type(begin_index)}")
            exit(True)
        else:
            self.__row_begin_1 = begin_index
        return self

    def get_row_end_1(self):
        return self.__row_end_1

    def 配置表1运算截止行(self, row_index):
        if type(row_index) != type(int()):
            print(f"多列多行迭代运算配置文件->配置表1运算起始行错误!,需要一个{type(int())},参数为{type(row_index)}")
            exit(True)
        else:
            self.__row_end_1 = row_index
        return self

    # 表1配置 -------------->>>>>>>>>>>>  结束

    # 表2配置 -------------->>>>>>>>>>>>  开始
    def get_df_2(self):
        return self.__df_2

    def 配置数据集2(self, df):
        if type(df) != type(pandas.DataFrame()):
            print(f"多列多行迭代运算配置文件错误,需要一个{type(pandas.DataFrame())},参数为{type(df)}")
            exit(True)
        else:
            self.__df_2 = df
        return self

    def get_col_list_2(self):
        return self.__col_list_2

    def 配置表2列索引(self, col_list):
        self.__col_list_2 = []
        if type(col_list) != type(list()):
            self.__col_list_2.append(col_list)
        else:
            self.__col_list_2.extend(col_list)
        return self

    def get_row_list_2(self):
        return self.__row_list_2

    def 配置表2行索引(self, row_list):
        self.__row_list_2 = []
        if type(row_list) != type(list()):
            self.__row_list_2.append(row_list)
        else:
            self.__row_list_2.extend(row_list)
        return self

    def get_col_begin_2(self):
        return self.__col_begin_2

    def 配置表2运算起始列(self, begin_index):
        if type(begin_index) != type(int()):
            print(f"多列多行迭代运算配置文件->配置表1运算起始列错误!,需要一个{type(int())},参数为{type(begin_index)}")
            exit(True)
        else:
            self.__col_begin_2 = begin_index
        return self

    def get_col_end_2(self):
        return self.__col_end_2

    def 配置表2运算截止列(self, end_index):
        if type(end_index) != type(int()):
            print(f"多列多行迭代运算配置文件->配置表1运算截止列错误!,需要一个{type(int())},参数为{type(end_index)}")
            exit(True)
        else:
            self.__col_end_2 = end_index
        return self

    def get_row_begin_2(self):
        return self.__row_begin_2

    def 配置表2运算起始行(self, begin_index):
        if type(begin_index) != type(int()):
            print(f"多列多行迭代运算配置文件->配置表1运算起始行错误!,需要一个{type(int())},参数为{type(begin_index)}")
            exit(True)
        else:
            self.__row_begin_2 = begin_index
        return self

    def get_row_end_2(self):
        return self.__row_end_2

    def 配置表2运算截止行(self, row_index):
        if type(row_index) != type(int()):
            print(f"多列多行迭代运算配置文件->配置表1运算起始行错误!,需要一个{type(int())},参数为{type(row_index)}")
            exit(True)
        else:
            self.__row_end_2 = row_index
        return self

    # 表2配置 -------------->>>>>>>>>>>>  结束

    # 通用配置 ------>>>>>>>>  开始

    def get_return_table_style(self):
        return self.__return_table_style

    def 配置返回的数据表格式(self, flag=False):
        """
        默认值为False  返回表1的格式, true为表二的格式
        """
        self.__return_table_style = flag
        return self

    def get_operator(self):
        return self.__operator

    def 配置运算符(self,operator:运算符):
        self.__operator = operator
        return self

# 通用配置 ------>>>>>>>>  结束
